{% extends 'base.html' %}
{% load staticfiles %}

{% block title %}
    公开课列表 - 谷粒教育网
{% endblock %}

{% block content %}
    <section>
        <div class="wp">
            <ul class="crumbs">
                <li><a href="/">首页</a>></li>
                <li>公开课</li>
            </ul>
        </div>
    </section>

    <section>
        <div class="wp">
            <div class="list" style="margin-top:0;">
                <div class="left layout">
                    <div class="head">
                        <ul class="tab_header">
                            <li {% if sort == '' %} class="active" {% endif %}><a href="?sort=">最新 </a></li>
                            <li {% if sort == 'click_num' %} class="active" {% endif %}><a href="?sort=click_num">最热门</a></li>
                            <li {% if sort == 'study_num' %} class="active" {% endif %}><a href="?sort=study_num">参与人数</a></li>
                        </ul>
                    </div>
                    {# 课程列表展示 #}
                    <div id="inWindow">
                        <div class="tab_cont " id="content">
                            <div class="group_list">
                                {% for course in pages %}
                                    <div class="box">
                                        <a href="{% url 'courses:course_detail' course.id %}">
                                            <img width="280" height="350" class="scrollLoading" src="{{ MEDIA_URL }}{{ course.image }}"/>
                                        </a>
                                        <div class="des">
                                            <a href="{% url 'courses:course_detail' course.id %}">
                                                <h2>{{ course.name }}</h2>
                                            </a>
                                            <span class="fl">时长：<i class="key">{{ course.study_time }}</i></span>
                                            <span class="fr">学习人数：{{ course.study_num }}&nbsp;&nbsp;</span>
                                        </div>
                                        <div class="bottom">
                                            <a href="{% url 'courses:course_detail' course.id %}"><span class="fl">来自{{ course.orginfo.name }}</span></a>
                                            <span class="star fr  notlogin" data-favid="15">
                                        {{ course.love_num }}
                                        </span>
                                        </div>
                                    </div>
                                {% endfor %}

                                {# 课程列表分页显示 #}
                                <div class="pageturn">
                                    <ul class="pagelist">
                                        {# 是否有上一页,有就获取上一页 页码值 #}
                                        {% if pages.has_previous %}
                                            <li class="long"><a href="?page_num={{ pages.previous_page_number }}&sort={{ sort }}&keywords={{ keywords }} ">上一页</a></li>
                                        {% endif %}

                                        {# 课程分页页码展示 #}
                                        {% for num in pages.paginator.page_range %}
                                            {# 选中当前页面进行标识 #}
                                            <li {% if num == pages.number %} class="active" {% endif %}><a href="?page_num={{ num }}&sort={{ sort }}&keywords={{ keywords }} ">{{ num }}</a></li>
                                        {% endfor %}

                                        {# 是否有上一页,有就获取上一页 页码值 #}
                                        {% if pages.has_next %}
                                            <li class="long"><a href="?page_num={{ pages.next_page_number }}&sort={{ sort }}&keywords={{ keywords }} ">下一页</a></li>
                                        {% endif %}

                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                    {# 热门课程推荐 #}
                    <div class="right layout">
                        <div class="head">热门课程推荐</div>
                        <div class="group_recommend">
                            {% for course in recommend_courses %}
                            <dl>
                                <dt>
                                    <a target="_blank" href="{% url 'courses:course_detail' course.id %}">
                                        <img width="240" height="220" class="scrollLoading" src="{{ MEDIA_URL }}{{ course.image }}"/>
                                    </a>
                                </dt>
                                <dd>
                                    <a target="_blank" href="{% url 'courses:course_detail' course.id %}"><h2>{{ course.name }}</h2></a>
                                    <span class="fl">难度：
                                        {% if course.level == 'cj' %}
                                        <i class="key">初级</i>
                                        {% elif course.level == 'zj' %}
                                        <i class="key">中级</i>
                                        {% elif course.level == 'gj' %}
                                        <i class="key">高级</i>
                                        {% endif %}
                                    </span>
                                </dd>
                            </dl>
                            {% endfor %}
                        </div>
                    </div>

                </div>
        </div>
    </section>
{% endblock %}


